package me.jessyan.mvparms.demo.mvp.model;

import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;

import java.util.HashMap;
import java.util.Map;

import javax.inject.Inject;

import io.reactivex.Observable;
import me.jessyan.mvparms.demo.data.api.service.RichEditorService;
import me.jessyan.mvparms.demo.data.entity.MessageInfoEntity;
import me.jessyan.mvparms.demo.mvp.contract.RichEditorContract;
import me.jessyan.mvparms.demo.data.api.service.MainService;
import me.jessyan.mvparms.demo.data.entity.TopResponse;
import me.jessyan.mvparms.demo.data.entity.UploadImgEntity;
import okhttp3.MultipartBody;

/**
 * @Author: 海洋
 * @Date: 2018/8/22
 * @Desc:
 */
public class RichEditorModel extends BaseModel implements RichEditorContract.Model {


    @Inject
    public RichEditorModel(IRepositoryManager repositoryManager) {
        super(repositoryManager);
    }

    @Override
    public Observable<TopResponse<UploadImgEntity>> uploadImage(MultipartBody.Part imgs) {
        return mRepositoryManager
                .obtainRetrofitService(RichEditorService.class)
                .uploadImage(imgs);
    }

    @Override
    public Observable<TopResponse<MessageInfoEntity>> getMessageInfoById(String id) {
        return mRepositoryManager
                .obtainRetrofitService(RichEditorService.class)
                .getMessageInfoById(id);
    }

    @Override
    public Observable<TopResponse<Object>> addMessage(String title, String content) {
        return mRepositoryManager
                .obtainRetrofitService(RichEditorService.class)
                .addMessage(title,content);
    }

    @Override
    public Observable<TopResponse<Object>> editMessage(String id, String title, String content) {
        return mRepositoryManager
                .obtainRetrofitService(RichEditorService.class)
                .editMessage(id,title,content);
    }


    @Override
    public void onDestroy() {

    }
}
